package com.shumei.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shumei.dao.mapper.HrInfromationMapper;
import com.shumei.dao.pojo.Application;
import com.shumei.dao.pojo.HrInformation;
import com.shumei.service.HrInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HrInformationServiceImpl implements HrInformationService {
  @Autowired
    HrInfromationMapper hrInfromationMapper;
    @Override
    public void insertHrInformation(HrInformation hrInformation) {

        int i =hrInfromationMapper.insert(hrInformation);
        if (i > 0) {
            System.out.println("hr信息录入成功");

        } else {
            System.out.println("hr信息录入失败");

        }
    }

    @Override
    public HrInformation selectByHrId(Long hrid) {
        QueryWrapper<HrInformation> wrapper=new QueryWrapper<HrInformation>();
        wrapper.eq("hr_id",hrid);
        HrInformation hrInformation=hrInfromationMapper.selectOne(wrapper);
        return hrInformation;
    }

    @Override
    public void updateHrInformation(HrInformation hrInformation) {
        QueryWrapper<HrInformation> wrapper=new QueryWrapper<HrInformation>();
        wrapper.eq("id",hrInformation.getId());

        if (hrInfromationMapper.update(hrInformation,wrapper)>0){
            System.out.println("修改成功");
        }
        else {
            System.out.println("修改失败");
        }
    }

    @Override
    public List<HrInformation> selectHrInformation() {
        List<HrInformation> hrInformations=hrInfromationMapper.selectList(null);

        return hrInformations;
    }

    @Override
    public void deleteHrInformation(Long hrid) {
        int i = hrInfromationMapper.deleteById(hrid);
        if (i>0) {
            System.out.println("删除成功");
        }else{
            System.out.println("删除失败");
        }
    }
}
